import Classfity from "./ChildenZj/Classfity"
import CommtensMilde from "./ChildenZj/CommtensMilde"
import CoverUp from "./ChildenZj/CoverUp"
import NavTop from '../../componen/NavTop'
import PictureTottom from "./ChildenZj/PictureTottom"
import { useEffect, useState } from "react"
import axios from "axios"
import { useLocation } from "react-router-dom"
interface g {
    abstrucont: string,
    avatar: string,
    comments: number,
    cover: string,
    descc: string,
    fans: number,
    lov: number,
    nickname: string,
    pulses: number,
    supports: number,
    tag: string,
    // tags:string,
    title: string,
    uid: number,
    views: number


}
function DetailMain() {
    const id = useLocation().state;
    console.log(id)
    const [r, setr] = useState<g[]>([])
    function showDetail() {
        axios.get('http://127.0.0.1:81/ydcont', {
            params: {
                id
            }
        })
            .then(function (res) {
                console.log(res.data.results, 'wwwwww');
                setr(res.data.results)
                console.log('11111111');
                
            })
            .catch(function (error) {

            })
    }
    useEffect(() => {
        showDetail()
    }, [])
    return (
        <div className="BigCover">
            <div className="newnav" style={{ background: '#222'}}>< NavTop /> </div>
            {r.map(function (item: any) {
                return (<div className="CoverUp" key={item}><CoverUp 
                    cover={item.cover}
                    abstrucont={item.abstrucont}
                    avatar={item.avatar}
                    descc={item.descc}
                    fans={item.fans}
                    lov={item.lov}
                    nickname={item.nickname}
                    pulses={item.pulses}
                    title={item.title}
                    views={item.views}
                    tag={item.title}                           
                      /></div>)
            })}

            {r.map(function (item: any) {
                return (<div className="Classfity" key={item}><Classfity tags={item.tag} /></div>)
            })}

            <div className="CommtensMilde"
            id={id}
            ><CommtensMilde
            
             
             /></div> 
            <div className="PictureTottom"><PictureTottom /> </div>

        </div>
    )
}
export default DetailMain

{
    /* <div className="BigCover">
<div className="newnav" style={{background:'#222'}}> < NavTop /></div>
<div className="CoverUp"><CoverUp /></div>
<div className="Classfity"><Classfity /></div>
<div className="CommtensMilde"><CommtensMilde /></div>
<div className="PictureTottom"><PictureTottom/></div>
</div> */

}